refactor: replace QString() with QStringLiteral() for better performance
authorIntegral <integral@member.fsf.org>
Sat, 11 Jan 2025 02:51:30 +0000 (10:51 +0800)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 31 Jan 2025 14:11:02 +0000 (15:11 +0100)
Signed-off-by: Integral <integral@member.fsf.org>
44 files changed:
src/cmd/cmd.cpp
src/gui/application.cpp
src/gui/cloudproviders/cloudproviderwrapper.cpp
src/gui/creds/flow2auth.cpp
src/gui/filedetails/sharemodel.cpp
src/gui/foldercreationdialog.cpp
src/gui/folderstatusmodel.cpp
src/gui/ocssharejob.cpp
src/gui/remotewipe.cpp
src/gui/socketapi/socketapi.cpp
src/gui/syncrunfilelog.cpp
src/gui/tray/unifiedsearchresultslistmodel.cpp
src/gui/updater/ocupdater.cpp
src/gui/updater/updateinfo.cpp
src/gui/wizard/flow2authwidget.cpp
src/gui/wizard/welcomepage.cpp
src/libsync/abstractnetworkjob.cpp
src/libsync/account.cpp
src/libsync/clientproxy.cpp
src/libsync/configfile.cpp
src/libsync/creds/keychainchunk.cpp
src/libsync/discovery.cpp
src/libsync/networkjobs.cpp
src/libsync/nextcloudtheme.cpp
src/libsync/propagatedownload.cpp
src/libsync/propagateuploadng.cpp
src/libsync/propagateuploadv1.cpp
src/libsync/vfs/cfapi/cfapiwrapper.cpp
src/libsync/vfs/cfapi/shellext/customstateprovider.cpp
src/libsync/vfs/suffix/vfs_suffix.cpp
test/syncenginetestutils.h
test/testcfapishellextensionsipc.cpp
test/testchunkingng.cpp
test/testdownload.cpp
test/testexcludedfiles.cpp
test/testfolderwatcher.cpp
test/testinotifywatcher.cpp
test/testlockfile.cpp
test/testnetrcparser.cpp
test/testselectivesync.cpp
test/testsharemodel.cpp
test/testsyncconflict.cpp
test/testsyncengine.cpp
test/testutility.cpp

index cae496780074f34b99e35b0654a6077f30f1bf08..0b852625414ccb02c505a444ac59a349c82722df 100644 (file)
@@ -315,7 +315,7 @@ int main(int argc, char **argv)
 
 #ifdef Q_OS_WIN
     // Ensure OpenSSL config file is only loaded from app directory
-    QString opensslConf = QCoreApplication::applicationDirPath() + QString("/openssl.cnf");
+    QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf");
     qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit());
 #endif
 
index c5c0f7cb684cb62b8d26c1a12bb6f0a8db2bfc3f..4175ae5f0649b4b83cb1de58eed690dca21b959d 100644 (file)
@@ -222,7 +222,7 @@ Application::Application(int &argc, char **argv)
 
 #ifdef Q_OS_WIN
     // Ensure OpenSSL config file is only loaded from app directory
-    QString opensslConf = QCoreApplication::applicationDirPath() + QString("/openssl.cnf");
+    QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf");
     qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit());
 #endif
 
index 4ff2313c44cc142536e11a466bad8f3fde6cdecb..39d24b7956f5be15ce9cd36257918ef2a184eab9 100644 (file)
@@ -36,7 +36,7 @@ CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, int
 {
     GMenuModel *model = nullptr;
     GActionGroup *action_group = nullptr;
-    QString accountName = QString("Folder/%1").arg(folderId);
+    QString accountName = QStringLiteral("Folder/%1").arg(folderId);
 
     _cloudProvider = CLOUD_PROVIDERS_PROVIDER_EXPORTER(cloudprovider);
     _cloudProviderAccount = cloud_providers_account_exporter_new(_cloudProvider, accountName.toUtf8().data());
@@ -170,7 +170,7 @@ void CloudProviderWrapper::slotUpdateProgress(const QString &folder, const Progr
 
 void CloudProviderWrapper::updateStatusText(QString statusText)
 {
-    QString status = QString("%1 - %2").arg(_folder->accountState()->stateString(_folder->accountState()->state()), statusText);
+    QString status = QStringLiteral("%1 - %2").arg(_folder->accountState()->stateString(_folder->accountState()->state()), statusText);
     cloud_providers_account_exporter_set_status_details(_cloudProviderAccount, status.toUtf8().data());
 }
 
index f90873dbc6793315d15e1340330cb9d05c5ca7ae..b3cc7c937ac412e0daf28b18408447faaf03d724 100644 (file)
@@ -198,7 +198,7 @@ void Flow2Auth::slotPollTimerTimeout()
     req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
 
     auto requestBody = new QBuffer;
-    QUrlQuery arguments(QString("token=%1").arg(_pollToken));
+    QUrlQuery arguments(QStringLiteral("token=%1").arg(_pollToken));
     requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1());
 
     auto job = _account->sendRequest("POST", _pollEndpoint, req, requestBody);
index 73441a0627b296f184349cbec2ef12cf39d56b95..3e0662dc220ad6b95e59a5de243bd3c05465d301 100644 (file)
@@ -788,7 +788,7 @@ QString ShareModel::avatarUrlForShare(const SharePtr &share) const
         const auto provider = QStringLiteral("image://tray-image-provider/");
         const auto userId = share->getShareWith()->shareWith();
         const auto avatarUrl = Utility::concatUrlPath(_accountState->account()->url(),
-                                                      QString("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(64))).toString();
+                                                      QStringLiteral("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(64))).toString();
         return QString(provider + avatarUrl);
     }
 
@@ -1464,7 +1464,7 @@ QString ShareModel::generatePassword()
     static const QRegularExpression lowercaseMatch("[a-z]");
     static const QRegularExpression uppercaseMatch("[A-Z]");
     static const QRegularExpression numberMatch("[0-9]");
-    static const QRegularExpression specialCharMatch(QString("[%1]").arg(specialChars.data()));
+    static const QRegularExpression specialCharMatch(QStringLiteral("[%1]").arg(specialChars.data()));
 
     static const std::map<std::string_view, QRegularExpression> matchMap{
         {lowercaseAlphabet, lowercaseMatch},
index 302bc041282bc0d41234817b3efda87504c836ed..2d4f3c4cc4a986531479ae9cf5c9f952e2935f45 100644 (file)
@@ -45,7 +45,7 @@ FolderCreationDialog::FolderCreationDialog(const QString &destination, QWidget *
         ui->newFolderNameEdit->setText(suggestedFolderNamePrefix);
     } else {
         for (unsigned int i = 2; i < std::numeric_limits<unsigned int>::max(); ++i) {
-            const QString suggestedPostfix = QString(" (%1)").arg(i);
+            const QString suggestedPostfix = QStringLiteral(" (%1)").arg(i);
 
             if (!QDir(newFolderFullPath + suggestedPostfix).exists()) {
                 ui->newFolderNameEdit->setText(suggestedFolderNamePrefix + suggestedPostfix);
index 91808fc48c1229541b340430fb3f4eed427f7044..87c1f9d829375f94e595dd0d1bb20870093b06bf 100644 (file)
@@ -219,7 +219,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
         case Qt::DisplayRole:
             if (folderInfo->_hasError) {
                 return {tr("Error while loading the list of folders from the server.")
-                        + QString("\n")
+                        + QStringLiteral("\n")
                         + folderInfo->_lastErrorString};
             } else {
                 return tr("Fetching folder list from server â€¦");
index 1bc81dfd8d7329eaa99b6a98be7e86a6fde121d5..3f2236c3e853277c6daf865bfe0cf94aa1560656 100644 (file)
@@ -33,8 +33,8 @@ void OcsShareJob::getShares(const QString &path, const QMap<QString, QString> &p
     setVerb("GET");
 
     addParam(QString::fromLatin1("path"), path);
-    addParam(QString::fromLatin1("reshares"), QString("true"));
-    addParam(QString::fromLatin1("shared_with_me"), QString("true"));
+    addParam(QString::fromLatin1("reshares"), QStringLiteral("true"));
+    addParam(QString::fromLatin1("shared_with_me"), QStringLiteral("true"));
 
     for (auto it = std::cbegin(params); it != std::cend(params); ++it) {
         addParam(it.key(), it.value());
index 3d285637fb49741471436b79c83a7a7c6eba3e4b..7a146ce1bab65cb8b3aca8db027bad63d2a38d97 100644 (file)
@@ -58,7 +58,7 @@ void RemoteWipe::startCheckJobWithAppPassword(QString pwd){
     request.setUrl(requestUrl);
     request.setSslConfiguration(_account->getOrCreateSslConfig());
     auto requestBody = new QBuffer;
-    QUrlQuery arguments(QString("token=%1").arg(_appPassword));
+    QUrlQuery arguments(QStringLiteral("token=%1").arg(_appPassword));
     requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1());
     _networkReplyCheck = _networkManager.post(request, requestBody);
     QObject::connect(&_networkManager, &QNetworkAccessManager::sslErrors,
@@ -79,16 +79,16 @@ void RemoteWipe::checkJobSlot()
             jsonParseError.error != QJsonParseError::NoError) {
         QString errorFromJson = json["error"].toString();
         if (!errorFromJson.isEmpty()) {
-            qCWarning(lcRemoteWipe) << QString("Error returned from the server: <em>%1<em>")
+            qCWarning(lcRemoteWipe) << QStringLiteral("Error returned from the server: <em>%1<em>")
                                        .arg(errorFromJson.toHtmlEscaped());
         } else if (_networkReplyCheck->error() != QNetworkReply::NoError) {
-            qCWarning(lcRemoteWipe) << QString("There was an error accessing the 'token' endpoint: <br><em>%1</em>")
+            qCWarning(lcRemoteWipe) << QStringLiteral("There was an error accessing the 'token' endpoint: <br><em>%1</em>")
                               .arg(_networkReplyCheck->errorString().toHtmlEscaped());
         } else if (jsonParseError.error != QJsonParseError::NoError) {
-            qCWarning(lcRemoteWipe) << QString("Could not parse the JSON returned from the server: <br><em>%1</em>")
+            qCWarning(lcRemoteWipe) << QStringLiteral("Could not parse the JSON returned from the server: <br><em>%1</em>")
                               .arg(jsonParseError.errorString());
         } else {
-            qCWarning(lcRemoteWipe) <<  QString("The reply from the server did not contain all expected fields");
+            qCWarning(lcRemoteWipe) <<  QStringLiteral("The reply from the server did not contain all expected fields");
         }
 
     // check for wipe request
@@ -136,7 +136,7 @@ void RemoteWipe::notifyServerSuccessJob(AccountState *accountState, bool dataWip
         request.setUrl(requestUrl);
         request.setSslConfiguration(_account->getOrCreateSslConfig());
         auto requestBody = new QBuffer;
-        QUrlQuery arguments(QString("token=%1").arg(_appPassword));
+        QUrlQuery arguments(QStringLiteral("token=%1").arg(_appPassword));
         requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1());
         _networkReplySuccess = _networkManager.post(request, requestBody);
         QObject::connect(_networkReplySuccess, &QNetworkReply::finished, this,
@@ -153,16 +153,16 @@ void RemoteWipe::notifyServerSuccessJobSlot()
             jsonParseError.error != QJsonParseError::NoError) {
         QString errorFromJson = json["error"].toString();
         if (!errorFromJson.isEmpty()) {
-            qCWarning(lcRemoteWipe) << QString("Error returned from the server: <em>%1</em>")
+            qCWarning(lcRemoteWipe) << QStringLiteral("Error returned from the server: <em>%1</em>")
                               .arg(errorFromJson.toHtmlEscaped());
         } else if (_networkReplySuccess->error() != QNetworkReply::NoError) {
-            qCWarning(lcRemoteWipe) << QString("There was an error accessing the 'success' endpoint: <br><em>%1</em>")
+            qCWarning(lcRemoteWipe) << QStringLiteral("There was an error accessing the 'success' endpoint: <br><em>%1</em>")
                               .arg(_networkReplySuccess->errorString().toHtmlEscaped());
         } else if (jsonParseError.error != QJsonParseError::NoError) {
-            qCWarning(lcRemoteWipe) << QString("Could not parse the JSON returned from the server: <br><em>%1</em>")
+            qCWarning(lcRemoteWipe) << QStringLiteral("Could not parse the JSON returned from the server: <br><em>%1</em>")
                               .arg(jsonParseError.errorString());
         } else {
-            qCWarning(lcRemoteWipe) << QString("The reply from the server did not contain all expected fields.");
+            qCWarning(lcRemoteWipe) << QStringLiteral("The reply from the server did not contain all expected fields.");
         }
     }
 
index a3df567ee1fe55ebde66c985ceec0fb50a4a8029..37dab4b2b3734a6cd1747cf51893dc77b0f24f28 100644 (file)
@@ -1151,13 +1151,13 @@ void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *lis
         { "EMAIL_PRIVATE_LINK_MENU_TITLE", tr("Send private link by email â€¦") },
         { "CONTEXT_MENU_ICON", APPLICATION_ICON_NAME },
     } };
-    listener->sendMessage(QString("GET_STRINGS:BEGIN"));
+    listener->sendMessage(QStringLiteral("GET_STRINGS:BEGIN"));
     for (const auto& key_value : strings) {
         if (argument.isEmpty() || argument == QLatin1String(key_value.first)) {
-            listener->sendMessage(QString("STRING:%1:%2").arg(key_value.first, key_value.second));
+            listener->sendMessage(QStringLiteral("STRING:%1:%2").arg(key_value.first, key_value.second));
         }
     }
-    listener->sendMessage(QString("GET_STRINGS:END"));
+    listener->sendMessage(QStringLiteral("GET_STRINGS:END"));
 }
 
 void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, SharingContextItemEncryptedFlag itemEncryptionFlag, SharingContextItemRootEncryptedFolderFlag rootE2eeFolderFlag)
@@ -1325,7 +1325,7 @@ SocketApi::FileData SocketApi::FileData::parentFolder() const
 
 void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListener *listener)
 {
-    listener->sendMessage(QString("GET_MENU_ITEMS:BEGIN"), true);
+    listener->sendMessage(QStringLiteral("GET_MENU_ITEMS:BEGIN"), true);
     const QStringList files = split(argument);
 
     // Find the common sync folder.
@@ -1483,7 +1483,7 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
         }
     }
 
-    listener->sendMessage(QString("GET_MENU_ITEMS:END"));
+    listener->sendMessage(QStringLiteral("GET_MENU_ITEMS:END"));
 }
 
 DirectEditor* SocketApi::getDirectEditorForLocalFile(const QString &localFile)
index 5610fb6a02ff704b2ac202ee80e0979f05e83b3f..4150d1f92615b6b425f6500e4404436257c8978b 100644 (file)
@@ -52,7 +52,7 @@ void SyncRunFileLog::start(const QString &folderPath)
         if(QString::compare(folderPath,line,Qt::CaseSensitive)!=0) {
             depthIndex++;
             if(depthIndex <= length) {
-                filenameSingle = folderPath.split(QLatin1String("/")).at(length - depthIndex) + QString("_") ///
+                filenameSingle = folderPath.split(QLatin1String("/")).at(length - depthIndex) + QStringLiteral("_") ///
                         + filenameSingle;
                 filename = logpath+ QLatin1String("/") + filenameSingle + QLatin1String("_sync.log");
             }
index 2f461683cb76bd6cb3628b9707a80aae681f42b3..e7015afead5cf5481bd0d7e48f327a749d45283b 100644 (file)
@@ -383,7 +383,7 @@ void UnifiedSearchResultsListModel::slotSearchTermEditingFinished()
         &UnifiedSearchResultsListModel::slotSearchTermEditingFinished);
 
     if (!_accountState || !_accountState->account()) {
-        qCCritical(lcUnifiedSearch) << QString("Account state is invalid. Could not start search!");
+        qCCritical(lcUnifiedSearch) << QStringLiteral("Account state is invalid. Could not start search!");
         return;
     }
 
@@ -401,14 +401,14 @@ void UnifiedSearchResultsListModel::slotFetchProvidersFinished(const QJsonDocume
     const auto job = qobject_cast<JsonApiJob *>(sender());
 
     if (!job) {
-        qCCritical(lcUnifiedSearch) << QString("Failed to fetch providers.").arg(_searchTerm);
+        qCCritical(lcUnifiedSearch) << QStringLiteral("Failed to fetch providers.").arg(_searchTerm);
         _errorString += tr("Failed to fetch providers.") + QLatin1Char('\n');
         emit errorStringChanged();
         return;
     }
     
     if (statusCode != 200) {
-        qCCritical(lcUnifiedSearch) << QString("%1: Failed to fetch search providers for '%2'. Error: %3")
+        qCCritical(lcUnifiedSearch) << QStringLiteral("%1: Failed to fetch search providers for '%2'. Error: %3")
                                            .arg(statusCode)
                                            .arg(_searchTerm)
                                            .arg(job->errorString());
@@ -446,7 +446,7 @@ void UnifiedSearchResultsListModel::slotSearchForProviderFinished(const QJsonDoc
     const auto job = qobject_cast<JsonApiJob *>(sender());
 
     if (!job) {
-        qCCritical(lcUnifiedSearch) << QString("Search has failed for '%2'.").arg(_searchTerm);
+        qCCritical(lcUnifiedSearch) << QStringLiteral("Search has failed for '%2'.").arg(_searchTerm);
         _errorString += tr("Search has failed for '%2'.").arg(_searchTerm) + QLatin1Char('\n');
         emit errorStringChanged();
         return;
@@ -471,7 +471,7 @@ void UnifiedSearchResultsListModel::slotSearchForProviderFinished(const QJsonDoc
     }
 
     if (statusCode != 200) {
-        qCCritical(lcUnifiedSearch) << QString("%1: Search has failed for '%2'. Error: %3")
+        qCCritical(lcUnifiedSearch) << QStringLiteral("%1: Search has failed for '%2'. Error: %3")
                                            .arg(statusCode)
                                            .arg(_searchTerm)
                                            .arg(job->errorString());
index e44cae12f6fdaec67984f7ae350aa764374d5b60..b5f6ad49ddf84c2c4836fac7674d64ecba30f82d 100644 (file)
@@ -221,7 +221,7 @@ void OCUpdater::slotStartInstaller()
         };
 
         QString msiLogFile = cfg.configPath() + "msi.log";
-        QString command = QString("&{msiexec /i '%1' /L*V '%2'| Out-Null ; &'%3'}")
+        QString command = QStringLiteral("&{msiexec /i '%1' /L*V '%2'| Out-Null ; &'%3'}")
              .arg(preparePathForPowershell(updateFile))
              .arg(preparePathForPowershell(msiLogFile))
              .arg(preparePathForPowershell(QCoreApplication::applicationFilePath()));
index 2bfb720fb63a54ad3aa7826c94ce16de71d1ffac..5fa7236acc2ae90057644485a6929ab519707bfa 100644 (file)
@@ -88,7 +88,7 @@ UpdateInfo UpdateInfo::parseString(const QString &xml, bool *ok)
     if (const auto result = doc.setContent(xml); !result) {
         qCWarning(lcUpdater).noquote().nospace() << result.errorMessage << " at " << result.errorLine << "," << result.errorColumn
                                 << "\n" <<  xml.split("\n").value(result.errorLine - 1) << "\n"
-                                << QString(" ").repeated(result.errorColumn - 1) << "^\n"
+                                << QStringLiteral(" ").repeated(result.errorColumn - 1) << "^\n"
                                 << "->" << xml << "<-";
         if (ok)
             *ok = false;
index e191648e32ad1a15e3ead1962973316fcdf58cb1..e89a08a7f250eacc28ca43b3a763f5ab1e04e7fe 100644 (file)
@@ -158,7 +158,7 @@ void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int second
             _statusUpdateSkipCount--;
             break;
         }
-        _ui.statusLabel->setText(tr("Waiting for authorization") + QString("… (%1)").arg(secondsLeft));
+        _ui.statusLabel->setText(tr("Waiting for authorization") + QStringLiteral("… (%1)").arg(secondsLeft));
         stopSpinner(true);
         break;
     case Flow2Auth::statusPollNow:
index 1228f51599d87e51bece37e60dbf3324cc96191c..fa706fbcd4052a46fddbb4474ed65608e717dc9d 100644 (file)
@@ -71,8 +71,8 @@ void WelcomePage::styleSlideShow()
     _ui->slideShow->addSlide(wizardTalkIconFileName, tr("Screensharing, online meetings & web conferences"));
 
     const auto isDarkBackground = Theme::isDarkColor(backgroundColor);
-    _ui->slideShowNextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), isDarkBackground));
-    _ui->slideShowPreviousButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), isDarkBackground));
+    _ui->slideShowNextButton->setIcon(theme->uiThemeIcon(QStringLiteral("control-next.svg"), isDarkBackground));
+    _ui->slideShowPreviousButton->setIcon(theme->uiThemeIcon(QStringLiteral("control-prev.svg"), isDarkBackground));
 }
 
 void WelcomePage::setupSlideShow()
index 313062481099e79e5abd7c579c9a0e7b4bc09a99..9b5590fd2e1fb249099e0aa42ba2d3bbd7955d4e 100644 (file)
@@ -358,7 +358,7 @@ void AbstractNetworkJob::start()
     _timer.start();
 
     const QUrl url = account()->url();
-    const QString displayUrl = QString("%1://%2%3").arg(url.scheme()).arg(url.host()).arg(url.path());
+    const QString displayUrl = QStringLiteral("%1://%2%3").arg(url.scheme()).arg(url.host()).arg(url.path());
 
     QString parentMetaObjectName = parent() ? parent()->metaObject()->className() : "";
     qCInfo(lcNetworkJob) << metaObject()->className() << "created for" << displayUrl << "+" << path() << parentMetaObjectName;
index 82f0376dd5e8564aab1ab4db7417a0cf7ace9f7e..f45b70f211153018a6beb6569dfa56c3182b3241 100644 (file)
@@ -164,7 +164,7 @@ QString Account::displayName() const
         credentialsUser = _credentials->user();
     }
 
-    auto displayName = QString("%1@%2").arg(credentialsUser, _url.host());
+    auto displayName = QStringLiteral("%1@%2").arg(credentialsUser, _url.host());
     const auto port = url().port();
     if (port > 0 && port != 80 && port != 443) {
         displayName.append(QLatin1Char(':'));
index 2deba9d546943b6e7ee0c95fef295a3cfe3b021e..48c277de626d12d166c2cced1b563690fd1abe4d 100644 (file)
@@ -78,7 +78,7 @@ const char *ClientProxy::proxyTypeToCStr(QNetworkProxy::ProxyType type)
 
 QString ClientProxy::printQNetworkProxy(const QNetworkProxy &proxy)
 {
-    return QString("%1://%2:%3").arg(proxyTypeToCStr(proxy.type())).arg(proxy.hostName()).arg(proxy.port());
+    return QStringLiteral("%1://%2:%3").arg(proxyTypeToCStr(proxy.type())).arg(proxy.hostName()).arg(proxy.port());
 }
 
 void ClientProxy::setupQtProxyFromConfig()
index 2b1cda432e597094ff865ce9e6b71bff398aa468..37ea14d6ff3d370272ce21b46cc4af4f79a785d7 100644 (file)
@@ -463,7 +463,7 @@ QString ConfigFile::backup(const QString &fileName) const
     }
 
     QString backupFile =
-        QString("%1.backup_%2%3")
+        QStringLiteral("%1.backup_%2%3")
             .arg(baseFilePath)
             .arg(QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss"))
             .arg(versionString);
index dc2fff401dba60621eb01e338dd7251143b71220..115c4321dbdc83b56023c0c288b4d026265d44b0 100644 (file)
@@ -205,7 +205,7 @@ void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob)
             return;
         }
 
-        const QString keyWithIndex = _key + (index > 0 ? (QString(".") + QString::number(index)) : QString());
+        const QString keyWithIndex = _key + (index > 0 ? (QStringLiteral(".") + QString::number(index)) : QString());
         const QString kck = _account ? AbstractCredentials::keychainKey(
                 _account->url().toString(),
                 keyWithIndex,
@@ -313,7 +313,7 @@ void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob)
 #if defined(Q_OS_WIN)
         // try to fetch next chunk
         if (_chunkCount < KeychainChunk::MaxChunks) {
-            const QString keyWithIndex = _key + QString(".") + QString::number(_chunkCount);
+            const QString keyWithIndex = _key + QStringLiteral(".") + QString::number(_chunkCount);
             const QString kck = _account ? AbstractCredentials::keychainKey(
                     _account->url().toString(),
                     keyWithIndex,
@@ -442,7 +442,7 @@ void DeleteJob::slotDeleteJobDone(QKeychain::Job *incomingJob)
 #if defined(Q_OS_WIN)
         // try to delete next chunk
         if (_chunkCount < KeychainChunk::MaxChunks) {
-            const QString keyWithIndex = _key + QString(".") + QString::number(_chunkCount);
+            const QString keyWithIndex = _key + QStringLiteral(".") + QString::number(_chunkCount);
             const QString kck = _account ? AbstractCredentials::keychainKey(
                     _account->url().toString(),
                     keyWithIndex,
index dfd59a3b8cf82ed7d8f1b8071a6ee8d87402dbd8..853284f13f5c331f742916e8fd92baf4765d4988 100644 (file)
@@ -450,7 +450,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
             if (containsForbiddenCharacters) {
                 reasonString = tr("Reason: the filename contains a forbidden character (%1).").arg(forbiddenCharMatch);
             }
-            item->_errorString = reasonString.isEmpty() ? errorString : QString("%1 %2").arg(errorString, reasonString);
+            item->_errorString = reasonString.isEmpty() ? errorString : QStringLiteral("%1 %2").arg(errorString, reasonString);
             item->_status = SyncFileItem::FileNameInvalidOnServer;
             break;
         }
index 3369050033374d8c3078a9eaee2379b51ee4b736..c01ab82e2b01d9bbb55d89afeeed97ed94fc1375 100644 (file)
@@ -793,9 +793,9 @@ AvatarJob::AvatarJob(AccountPtr account, const QString &userId, int size, QObjec
     : AbstractNetworkJob(account, QString(), parent)
 {
     if (account->serverVersionInt() >= Account::makeServerVersion(10, 0, 0)) {
-        _avatarUrl = Utility::concatUrlPath(account->url(), QString("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(size)));
+        _avatarUrl = Utility::concatUrlPath(account->url(), QStringLiteral("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(size)));
     } else {
-        _avatarUrl = Utility::concatUrlPath(account->url(), QString("index.php/avatar/%1/%2").arg(userId, QString::number(size)));
+        _avatarUrl = Utility::concatUrlPath(account->url(), QStringLiteral("index.php/avatar/%1/%2").arg(userId, QString::number(size)));
     }
 }
 
index 2a709564c6e4abbb267595ca662406823f37ffc0..cae0e68da6eebae44ddc174b57c1f3373bb14bbc 100644 (file)
@@ -35,7 +35,7 @@ NextcloudTheme::NextcloudTheme()
 
 QString NextcloudTheme::wizardUrlHint() const
 {
-    return QString("https://try.nextcloud.com");
+    return QStringLiteral("https://try.nextcloud.com");
 }
 
 }
index 39108e4e113d46bc8353ff2fa06503f707180392..4f644315067808b23c92715bf38af0f0ae4bbdf4 100644 (file)
@@ -1108,7 +1108,7 @@ namespace { // Anonymous namespace for the recall feature
         int chownErr = chown(fileName.toLocal8Bit().constData(), -1, fi.groupId());
         if (chownErr) {
             // TODO: Consider further error handling!
-            qCWarning(lcPropagateDownload) << QString("preserveGroupOwnership: chown error %1: setting group %2 failed on file %3").arg(chownErr).arg(fi.groupId()).arg(fileName);
+            qCWarning(lcPropagateDownload) << QStringLiteral("preserveGroupOwnership: chown error %1: setting group %2 failed on file %3").arg(chownErr).arg(fi.groupId()).arg(fileName);
         }
 #else
         Q_UNUSED(fileName);
@@ -1313,7 +1313,7 @@ void PropagateDownloadFile::downloadFinished()
     emit propagator()->touchedFile(filename);
     // The fileChanged() check is done above to generate better error messages.
     if (!FileSystem::uncheckedRenameReplace(_tmpFile.fileName(), filename, &error)) {
-        qCWarning(lcPropagateDownload) << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(filename);
+        qCWarning(lcPropagateDownload) << QStringLiteral("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(filename);
         // If the file is locked, we want to retry this sync when it
         // becomes available again, otherwise try again directly
         if (FileSystem::isFileLocked(filename)) {
index e193e9561178df2918e22b6ce269d83208f6c107..be5cd5995a9b381eb3c9468532f319aa020fa09b 100644 (file)
@@ -50,7 +50,7 @@ QUrl PropagateUploadFileNG::chunkUrl(const int chunk) const
     constexpr auto maxChunkDigits = 5; // Chunk V2: max num of chunks is 10000
 
     // We need to do add leading 0 because the server orders the chunk alphabetically
-    const auto chunkNumString = QString("%1").arg(chunk, maxChunkDigits, 10, QChar('0'));
+    const auto chunkNumString = QStringLiteral("%1").arg(chunk, maxChunkDigits, 10, QChar('0'));
     return Utility::concatUrlPath(chunkUploadFolderUrl(), chunkNumString);
 }
 
index 6bab06305b756cc9ac64da8f63e2cdc5d6236b81..31b2703eeed6d1ed34dc7f2cf9881102cc702b05 100644 (file)
@@ -115,7 +115,7 @@ void PropagateUploadFileV1::startNextChunk()
         // XOR with chunk size to make sure everything goes well if chunk size changes between runs
         uint transid = _transferId ^ uint(chunkSize());
         qCInfo(lcPropagateUploadV1) << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid;
-        path += QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk);
+        path += QStringLiteral("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk);
 
         headers[QByteArrayLiteral("OC-Chunked")] = QByteArrayLiteral("1");
 
index 5828cd3a048d2237c1a0f0c24b654d7402f8b4f6..b088dfcb48838caac01a9b489557b978d123fcaa 100644 (file)
@@ -569,7 +569,7 @@ bool createSyncRootRegistryKeys(const QString &providerName, const QString &fold
 
     // syncRootId should be: [storage provider ID]![Windows SID]![Account ID]![FolderAlias] (FolderAlias is a custom part added here to be able to register multiple sync folders for the same account)
     // folder registry keys go like: Nextcloud!S-1-5-21-2096452760-2617351404-2281157308-1001!user@nextcloud.lan:8080!0, Nextcloud!S-1-5-21-2096452760-2617351404-2281157308-1001!user@nextcloud.lan:8080!1, etc. for each sync folder
-    const auto syncRootId = QString("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias);
+    const auto syncRootId = QStringLiteral("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias);
 
     const QString providerSyncRootIdRegistryKey = syncRootManagerRegKey + QStringLiteral("\\") + syncRootId;
     const QString providerSyncRootIdUserSyncRootsRegistryKey = providerSyncRootIdRegistryKey + QStringLiteral(R"(\UserSyncRoots\)");
@@ -617,7 +617,7 @@ bool deleteSyncRootRegistryKey(const QString &syncRootPath, const QString &provi
             return false;
         }
 
-        const auto currentUserSyncRootIdPattern = QString("%1!%2!%3").arg(providerName).arg(windowsSid).arg(accountDisplayName);
+        const auto currentUserSyncRootIdPattern = QStringLiteral("%1!%2!%3").arg(providerName).arg(windowsSid).arg(accountDisplayName);
 
         bool result = true;
 
@@ -691,7 +691,7 @@ void unregisterSyncRootShellExtensions(const QString &providerName, const QStrin
         return;
     }
 
-    const auto syncRootId = QString("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias);
+    const auto syncRootId = QStringLiteral("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias);
 
     const QString providerSyncRootIdRegistryKey = syncRootManagerRegKey + QStringLiteral("\\") + syncRootId;
 
@@ -757,7 +757,7 @@ bool OCC::CfApiWrapper::isAnySyncRoot(const QString &providerName, const QString
         return false;
     }
 
-    const auto syncRootPrefix = QString("%1!%2!%3!").arg(providerName).arg(windowsSid).arg(accountDisplayName);
+    const auto syncRootPrefix = QStringLiteral("%1!%2!%3!").arg(providerName).arg(windowsSid).arg(accountDisplayName);
 
     if (Utility::registryKeyExists(HKEY_LOCAL_MACHINE, syncRootManagerRegKey)) {
         bool foundSyncRoots = false;
index 8f7a2266fa4b80df47c402abde93607cb5dd7c1a..baa92cfbb82662a3784fc3f589f8d17a9bc76254 100644 (file)
@@ -84,8 +84,8 @@ CustomStateProvider::GetItemProperties(hstring const &itemPath)
 
             winrt::Windows::Storage::Provider::StorageProviderItemProperty itemProperty;
             itemProperty.Id(stateValue);
-            itemProperty.Value(QString("Value%1").arg(stateValue).toStdWString());
-            itemProperty.IconResource(QString(_dllFilePath + QString(",%1").arg(QString::number(stateValue))).toStdWString());
+            itemProperty.Value(QStringLiteral("Value%1").arg(stateValue).toStdWString());
+            itemProperty.IconResource(QString(_dllFilePath + QStringLiteral(",%1").arg(QString::number(stateValue))).toStdWString());
             properties.push_back(std::move(itemProperty));
         }
     }
index 59c868b31fb690f73b4359725e1133c71e549593..b1c9dcea997f6607c6e4355908abecb9c6dfce6f 100644 (file)
@@ -95,13 +95,13 @@ Result<void, QString> VfsSuffix::createPlaceholder(const SyncFileItem &item)
     QString fn = _setupParams.filesystemPath + item._file;
     if (!fn.endsWith(fileSuffix())) {
         ASSERT(false, "vfs file isn't ending with suffix");
-        return QString("vfs file isn't ending with suffix");
+        return QStringLiteral("vfs file isn't ending with suffix");
     }
 
     QFile file(fn);
     if (file.exists() && file.size() > 1
         && !FileSystem::verifyFileUnchanged(fn, item._size, item._modtime)) {
-        return QString("Cannot create a placeholder because a file with the placeholder name already exist");
+        return QStringLiteral("Cannot create a placeholder because a file with the placeholder name already exist");
     }
 
     if (!file.open(QFile::ReadWrite | QFile::Truncate))
index fee77f1494c89ed6f0206fc3089e8255054e7fc2..9a288d97dd7ce4eae1bc842707d7478538f50510 100644 (file)
@@ -640,18 +640,18 @@ struct ItemCompletedSpy : QSignalSpy {
 // QTest::toString overloads
 namespace OCC {
     inline char *toString(const SyncFileStatus &s) {
-        return QTest::toString(QString("SyncFileStatus(" + s.toSocketAPIString() + ")"));
+        return QTest::toString(QStringLiteral("SyncFileStatus(%1)").arg(s.toSocketAPIString()));
     }
 }
 
 inline void addFiles(QStringList &dest, const FileInfo &fi)
 {
     if (fi.isDir) {
-        dest += QString("%1 - dir").arg(fi.path());
+        dest += QStringLiteral("%1 - dir").arg(fi.path());
         foreach (const FileInfo &fi, fi.children)
             addFiles(dest, fi);
     } else {
-        dest += QString("%1 - %2 %3-bytes").arg(fi.path()).arg(fi.size).arg(fi.contentChar);
+        dest += QStringLiteral("%1 - %2 %3-bytes").arg(fi.path()).arg(fi.size).arg(fi.contentChar);
     }
 }
 
@@ -661,7 +661,7 @@ inline QString toStringNoElide(const FileInfo &fi)
     foreach (const FileInfo &fi, fi.children)
         addFiles(files, fi);
     files.sort();
-    return QString("FileInfo with %1 files(\n\t%2\n)").arg(files.size()).arg(files.join("\n\t"));
+    return QStringLiteral("FileInfo with %1 files(\n\t%2\n)").arg(files.size()).arg(files.join("\n\t"));
 }
 
 inline char *toString(const FileInfo &fi)
@@ -673,7 +673,7 @@ inline void addFilesDbData(QStringList &dest, const FileInfo &fi)
 {
     // could include etag, permissions etc, but would need extra work
     if (fi.isDir) {
-        dest += QString("%1 - %2 %3 %4").arg(
+        dest += QStringLiteral("%1 - %2 %3 %4").arg(
             fi.name,
             fi.isDir ? "dir" : "file",
             QString::number(fi.lastModified.toSecsSinceEpoch()),
@@ -681,7 +681,7 @@ inline void addFilesDbData(QStringList &dest, const FileInfo &fi)
         foreach (const FileInfo &fi, fi.children)
             addFilesDbData(dest, fi);
     } else {
-        dest += QString("%1 - %2 %3 %4 %5").arg(
+        dest += QStringLiteral("%1 - %2 %3 %4 %5").arg(
             fi.name,
             fi.isDir ? "dir" : "file",
             QString::number(fi.size),
@@ -695,5 +695,5 @@ inline char *printDbData(const FileInfo &fi)
     QStringList files;
     foreach (const FileInfo &fi, fi.children)
         addFilesDbData(files, fi);
-    return QTest::toString(QString("FileInfo with %1 files(%2)").arg(files.size()).arg(files.join(", ")));
+    return QTest::toString(QStringLiteral("FileInfo with %1 files(%2)").arg(files.size()).arg(files.join(", ")));
 }
index 12af7724c1cbd59b06725e6b1d1689d2fbcce317..3b823097adbdfadc55305e128b4d3d883b1ac610 100644 (file)
@@ -241,7 +241,7 @@ private slots:
         std::thread t1([&] {
             VfsShellExtensions::ThumbnailProviderIpc thumbnailProviderIpc;
             thumbnailReplyData = thumbnailProviderIpc.fetchThumbnailForFile(
-                fakeFolder.localPath() + QString("A/photos/wrong.jpg"), QSize(256, 256));
+                fakeFolder.localPath() + QStringLiteral("A/photos/wrong.jpg"), QSize(256, 256));
             QMetaObject::invokeMethod(&loop, &QEventLoop::quit, Qt::QueuedConnection);
         });
         loop.exec();
index 35d08f02e0b069f142891c4f96fdb74f603e64cd..10b89d7215f1793ad52474e79a4ad7ed7aab61a4 100644 (file)
@@ -100,7 +100,7 @@ private slots:
         const auto chunkingId = fakeFolder.uploadState().children.first().name;
         const auto chunkMap = fakeFolder.uploadState().children.first().children;
         const auto firstChunkName = chunkMap.first().name;
-        const auto expectedChunkName = QString("%1").arg(1, 5, 10, QChar('0'));
+        const auto expectedChunkName = QStringLiteral("%1").arg(1, 5, 10, QChar('0'));
         QCOMPARE(firstChunkName, expectedChunkName);
     }
 
@@ -232,7 +232,7 @@ private slots:
 
         // Add a chunk that makes the file completely uploaded
         const auto testChunkNameNum = chunkMap.count() + 1; // Chunk nums start at 1 with Chunk V2, so size() == last num, add 1
-        const auto testChunkName = QString("%1").arg(testChunkNameNum, 5, 10, QChar('0'));
+        const auto testChunkName = QStringLiteral("%1").arg(testChunkNameNum, 5, 10, QChar('0'));
         const auto testChunkSize = size - uploadedSize;
         fakeFolder.uploadState().children.first().insert(testChunkName, testChunkSize);
 
@@ -285,7 +285,7 @@ private slots:
 
         // Add a chunk that makes the file more than completely uploaded
         const auto testChunkNameNum = chunkMap.count() + 1; // Chunk nums start at 1 with Chunk V2, so size() == last num, add 1
-        const auto testChunkName = QString("%1").arg(testChunkNameNum, 5, 10, QChar('0'));
+        const auto testChunkName = QStringLiteral("%1").arg(testChunkNameNum, 5, 10, QChar('0'));
         const auto testChunkSize = size - uploadedSize + 100;
         fakeFolder.uploadState().children.first().insert(testChunkName, testChunkSize);
 
index 62108f457b51a7773c2b51ed5ac06a478d838d12..97df1c0983965e818cf5f47389fd6ec5b512bc8b 100644 (file)
@@ -82,7 +82,7 @@ private slots:
 
         QVERIFY(!fakeFolder.syncOnce()); // The sync must fail because not all the file was downloaded
         QCOMPARE(getItem(completeSpy, "A/a0")->_status, SyncFileItem::SoftError);
-        QCOMPARE(getItem(completeSpy, "A/a0")->_errorString, QString("The file could not be downloaded completely."));
+        QCOMPARE(getItem(completeSpy, "A/a0")->_errorString, QStringLiteral("The file could not be downloaded completely."));
         QVERIFY(fakeFolder.syncEngine().isAnotherSyncNeeded());
 
         // Now, we need to restart, this time, it should resume.
index ea525748447bfae823adace76a13c5844a7032cb..2fd33c990dd8aa971d0ead56e18aac90d3011a77 100644 (file)
@@ -715,7 +715,7 @@ private slots:
     void testAddExcludeFilePath_addSameFilePath_listSizeDoesNotIncrease()
     {
         excludedFiles.reset(new ExcludedFiles());
-        const auto filePath = QString("exclude/.sync-exclude.lst");
+        const auto filePath = QStringLiteral("exclude/.sync-exclude.lst");
         
         excludedFiles->addExcludeFilePath(filePath);
         excludedFiles->addExcludeFilePath(filePath);        
@@ -727,8 +727,8 @@ private slots:
     {
         excludedFiles.reset(new ExcludedFiles());
         
-        const auto filePath1 = QString("exclude1/.sync-exclude.lst");
-        const auto filePath2 = QString("exclude2/.sync-exclude.lst");
+        const auto filePath1 = QStringLiteral("exclude1/.sync-exclude.lst");
+        const auto filePath2 = QStringLiteral("exclude2/.sync-exclude.lst");
     
         excludedFiles->addExcludeFilePath(filePath1);
         excludedFiles->addExcludeFilePath(filePath2);
index 10d945b5de5d7bd3e328a665f3aa90491d731e31..598c361a76c4418c7c8472793e43285980ffa34c 100644 (file)
@@ -17,7 +17,7 @@ void touch(const QString &file)
     OCC::Utility::writeRandomFile(file);
 #else
     QString cmd;
-    cmd = QString("touch %1").arg(file);
+    cmd = QStringLiteral("touch %1").arg(file);
     qDebug() << "Command: " << cmd;
     system(cmd.toLocal8Bit());
 #endif
@@ -29,7 +29,7 @@ void mkdir(const QString &file)
     QDir dir;
     dir.mkdir(file);
 #else
-    QString cmd = QString("mkdir %1").arg(file);
+    QString cmd = QStringLiteral("mkdir %1").arg(file);
     qDebug() << "Command: " << cmd;
     system(cmd.toLocal8Bit());
 #endif
@@ -41,7 +41,7 @@ void rmdir(const QString &file)
     QDir dir;
     dir.rmdir(file);
 #else
-    QString cmd = QString("rmdir %1").arg(file);
+    QString cmd = QStringLiteral("rmdir %1").arg(file);
     qDebug() << "Command: " << cmd;
     system(cmd.toLocal8Bit());
 #endif
@@ -52,7 +52,7 @@ void rm(const QString &file)
 #ifdef Q_OS_WIN
     QFile::remove(file);
 #else
-    QString cmd = QString("rm %1").arg(file);
+    QString cmd = QStringLiteral("rm %1").arg(file);
     qDebug() << "Command: " << cmd;
     system(cmd.toLocal8Bit());
 #endif
@@ -63,7 +63,7 @@ void mv(const QString &file1, const QString &file2)
 #ifdef Q_OS_WIN
     QFile::rename(file1, file2);
 #else
-    QString cmd = QString("mv %1 %2").arg(file1, file2);
+    QString cmd = QStringLiteral("mv %1 %2").arg(file1, file2);
     qDebug() << "Command: " << cmd;
     system(cmd.toLocal8Bit());
 #endif
@@ -158,7 +158,7 @@ private slots:
     void testACreate() { // create a new file
         QString file(_rootPath + "/foo.txt");
         QString cmd;
-        cmd = QString("echo \"xyz\" > \"%1\"").arg(file);
+        cmd = QStringLiteral("echo \"xyz\" > \"%1\"").arg(file);
         qDebug() << "Command: " << cmd;
         system(cmd.toLocal8Bit());
 
index 204939f9132c66d873f5de0583cb74170c5847f6..bb87c4b4aa8398bcc3cc0e586a8bf66266df7114 100644 (file)
@@ -62,7 +62,7 @@ private slots:
 
     void cleanupTestCase() {
         if( _root.startsWith(QDir::tempPath() )) {
-           system( QString("rm -rf %1").arg(_root).toLocal8Bit() );
+           system( QStringLiteral("rm -rf %1").arg(_root).toLocal8Bit() );
         }
     }
 };
index 24d6ffa15d54fad7abf7df79a22c853ff96e6f04..4166de418162b2a3ab8f75b4c14bc919f0aeaba7 100644 (file)
@@ -782,8 +782,8 @@ private slots:
         fakeFolder.syncEngine().account()->setCapabilities({{"files", QVariantMap{{"locking", QByteArray{"1.0"}}}}});
         QSignalSpy lockFileDetectedNewlyUploadedSpy(&fakeFolder.syncEngine(), &OCC::SyncEngine::lockFileDetected);
 
-        fakeFolder.localModifier().insert(testDocumentsDirName + QString("/") + testLockFileName);
-        fakeFolder.localModifier().insert(testDocumentsDirName + QString("/") + testFileName);
+        fakeFolder.localModifier().insert(testDocumentsDirName + QStringLiteral("/") + testLockFileName);
+        fakeFolder.localModifier().insert(testDocumentsDirName + QStringLiteral("/") + testFileName);
 
         QVERIFY(fakeFolder.syncOnce());
 
index 3ab42698dcc2d2d2044497556013fcf16953972f..346737ac305d57f317ecdde4a0607e5e50d7156b 100644 (file)
@@ -54,11 +54,11 @@ private slots:
     void testValidNetrc() {
        NetrcParser parser(testfileC);
        QVERIFY(parser.parse());
-       QCOMPARE(parser.find("foo"), qMakePair(QString("bar"), QString("baz")));
-       QCOMPARE(parser.find("broken"), qMakePair(QString("bar2"), QString()));
-       QCOMPARE(parser.find("funnysplit"), qMakePair(QString("bar3"), QString("baz3")));
+       QCOMPARE(parser.find("foo"), qMakePair(QStringLiteral("bar"), QStringLiteral("baz")));
+       QCOMPARE(parser.find("broken"), qMakePair(QStringLiteral("bar2"), QString()));
+       QCOMPARE(parser.find("funnysplit"), qMakePair(QStringLiteral("bar3"), QStringLiteral("baz3")));
        QEXPECT_FAIL("", "Current implementation do not support spaces in username or password", Continue);
-       QCOMPARE(parser.find("frob"), qMakePair(QString("user with spaces"), QString("space pwd")));
+       QCOMPARE(parser.find("frob"), qMakePair(QStringLiteral("user with spaces"), QStringLiteral("space pwd")));
     }
 
     void testEmptyNetrc() {
@@ -70,8 +70,8 @@ private slots:
     void testValidNetrcWithDefault() {
        NetrcParser parser(testfileWithDefaultC);
        QVERIFY(parser.parse());
-       QCOMPARE(parser.find("foo"), qMakePair(QString("bar"), QString("baz")));
-       QCOMPARE(parser.find("dontknow"), qMakePair(QString("user"), QString("pass")));
+       QCOMPARE(parser.find("foo"), qMakePair(QStringLiteral("bar"), QStringLiteral("baz")));
+       QCOMPARE(parser.find("dontknow"), qMakePair(QStringLiteral("user"), QStringLiteral("pass")));
     }
 
     void testInvalidNetrc() {
index 2af525007009b7d91da816fa2065fde2f2f004bd..6ec7a5dd329283bd6b8a890b08bc5c2b0153b218 100644 (file)
@@ -65,7 +65,7 @@ private slots:
         QVERIFY(fakeFolder.syncOnce());
 
         QCOMPARE(newBigFolder.count(), 1);
-        QCOMPARE(newBigFolder.first()[0].toString(), QString("A/newBigDir"));
+        QCOMPARE(newBigFolder.first()[0].toString(), QStringLiteral("A/newBigDir"));
         QCOMPARE(newBigFolder.first()[1].toBool(), false);
         newBigFolder.clear();
 
@@ -75,7 +75,7 @@ private slots:
 
         auto oldSync = fakeFolder.currentLocalState();
         // syncing again should do the same
-        fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QString("A/newBigDir"));
+        fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QStringLiteral("A/newBigDir"));
         QVERIFY(fakeFolder.syncOnce());
         QCOMPARE(fakeFolder.currentLocalState(), oldSync);
         QCOMPARE(newBigFolder.count(), 1); // (since we don't have a real Folder, the files were not added to any list)
@@ -86,7 +86,7 @@ private slots:
         // Simulate that we accept all files by setting a wildcard white list
         fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList,
             QStringList() << QLatin1String("/"));
-        fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QString("A/newBigDir"));
+        fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QStringLiteral("A/newBigDir"));
         QVERIFY(fakeFolder.syncOnce());
         QCOMPARE(newBigFolder.count(), 0);
         QCOMPARE(sizeRequests.count(), 0);
index 6abfe79ce731a2b9f57fdabfa87a5bed4a0f8a5a..1385dc73dc06c8b7ffa76eff40959a6a9a2a7c4c 100644 (file)
@@ -371,7 +371,7 @@ private slots:
 
         // Check correct user avatar
         const auto avatarUrl = shareIndex.data(ShareModel::AvatarUrlRole).toString();
-        const auto relativeAvatarPath = QString("remote.php/dav/avatars/%1/%2.png").arg(_testUserShareDefinition.shareShareWith, QString::number(64));
+        const auto relativeAvatarPath = QStringLiteral("remote.php/dav/avatars/%1/%2.png").arg(_testUserShareDefinition.shareShareWith, QString::number(64));
         const auto expectedAvatarPath = Utility::concatUrlPath(helper.account->url(), relativeAvatarPath).toString();
         const QString expectedUrl(QStringLiteral("image://tray-image-provider/") + expectedAvatarPath);
         QCOMPARE(avatarUrl, expectedUrl);
index 1db24cf24e7cc9176f3b4ad2d0b101b5f32da35d..8190fb8ebe74341cb3882faed979128dfaf28996 100644 (file)
@@ -138,7 +138,7 @@ private slots:
         QCOMPARE(Utility::conflictFileBaseNameFromPattern(conflictMap[a1FileId].toUtf8()), QByteArray("A/a1"));
 
         // Check that the conflict file contains the username
-        QVERIFY(conflictMap[a1FileId].contains(QString("(conflicted copy %1 ").arg(fakeFolder.syncEngine().account()->davDisplayName())));
+        QVERIFY(conflictMap[a1FileId].contains(QStringLiteral("(conflicted copy %1 ").arg(fakeFolder.syncEngine().account()->davDisplayName())));
 
         QCOMPARE(remote.find(conflictMap[a1FileId])->contentChar, 'L');
         QCOMPARE(remote.find("A/a1")->contentChar, 'R');
index 8c11104cabd2147903ec99013a22de6997115305..cecd9ae59f65d0e3e0c55013180fdbc7faefcbcf 100644 (file)
@@ -721,7 +721,7 @@ private slots:
         // Begin Test mismatch recalculation---------------------------------------------------------------------------------
 
         const auto prevServerVersion = fakeFolder.account()->serverVersion();
-        fakeFolder.account()->setServerVersion(QString("%1.0.0").arg(fakeFolder.account()->checksumRecalculateServerVersionMinSupportedMajor()));
+        fakeFolder.account()->setServerVersion(QStringLiteral("%1.0.0").arg(fakeFolder.account()->checksumRecalculateServerVersionMinSupportedMajor()));
 
         // Mismatched OC-Checksum and X-Recalculate-Hash is not supported -> sync must fail
         isChecksumRecalculateSupported = false;
index efd6e684cc11b7aa5d22275185e92d01ed27a5fd..b1013d3cc3d04730313a77ed08bbdf02ec4da157 100644 (file)
@@ -39,29 +39,29 @@ private slots:
     void testOctetsToString()
     {
         QLocale::setDefault(QLocale("en"));
-        QCOMPARE(octetsToString(999) , QString("999 B"));
-        QCOMPARE(octetsToString(1024) , QString("1 KB"));
-        QCOMPARE(octetsToString(1110) , QString("1 KB"));
-        QCOMPARE(octetsToString(1364) , QString("1 KB"));
-
-        QCOMPARE(octetsToString(9110) , QString("9 KB"));
-        QCOMPARE(octetsToString(9910) , QString("10 KB"));
-        QCOMPARE(octetsToString(9999) , QString("10 KB"));
-        QCOMPARE(octetsToString(10240) , QString("10 KB"));
-
-        QCOMPARE(octetsToString(123456) , QString("121 KB"));
-        QCOMPARE(octetsToString(1234567) , QString("1.2 MB"));
-        QCOMPARE(octetsToString(12345678) , QString("12 MB"));
-        QCOMPARE(octetsToString(123456789) , QString("118 MB"));
-        QCOMPARE(octetsToString(1000LL*1000*1000 * 5) , QString("4.7 GB"));
-
-        QCOMPARE(octetsToString(1), QString("1 B"));
-        QCOMPARE(octetsToString(2), QString("2 B"));
-        QCOMPARE(octetsToString(1024), QString("1 KB"));
-        QCOMPARE(octetsToString(1024*1024), QString("1 MB"));
-        QCOMPARE(octetsToString(1024LL*1024*1024), QString("1 GB"));
-        QCOMPARE(octetsToString(1024LL*1024*1024*1024), QString("1 TB"));
-        QCOMPARE(octetsToString(1024LL*1024*1024*1024 * 5), QString("5 TB"));
+        QCOMPARE(octetsToString(999) , QStringLiteral("999 B"));
+        QCOMPARE(octetsToString(1024) , QStringLiteral("1 KB"));
+        QCOMPARE(octetsToString(1110) , QStringLiteral("1 KB"));
+        QCOMPARE(octetsToString(1364) , QStringLiteral("1 KB"));
+
+        QCOMPARE(octetsToString(9110) , QStringLiteral("9 KB"));
+        QCOMPARE(octetsToString(9910) , QStringLiteral("10 KB"));
+        QCOMPARE(octetsToString(9999) , QStringLiteral("10 KB"));
+        QCOMPARE(octetsToString(10240) , QStringLiteral("10 KB"));
+
+        QCOMPARE(octetsToString(123456) , QStringLiteral("121 KB"));
+        QCOMPARE(octetsToString(1234567) , QStringLiteral("1.2 MB"));
+        QCOMPARE(octetsToString(12345678) , QStringLiteral("12 MB"));
+        QCOMPARE(octetsToString(123456789) , QStringLiteral("118 MB"));
+        QCOMPARE(octetsToString(1000LL*1000*1000 * 5) , QStringLiteral("4.7 GB"));
+
+        QCOMPARE(octetsToString(1), QStringLiteral("1 B"));
+        QCOMPARE(octetsToString(2), QStringLiteral("2 B"));
+        QCOMPARE(octetsToString(1024), QStringLiteral("1 KB"));
+        QCOMPARE(octetsToString(1024*1024), QStringLiteral("1 MB"));
+        QCOMPARE(octetsToString(1024LL*1024*1024), QStringLiteral("1 GB"));
+        QCOMPARE(octetsToString(1024LL*1024*1024*1024), QStringLiteral("1 TB"));
+        QCOMPARE(octetsToString(1024LL*1024*1024*1024 * 5), QStringLiteral("5 TB"));
     }
 
     void testLaunchOnStartup()
@@ -88,35 +88,35 @@ private slots:
 
         QDateTime current = QDateTime::currentDateTimeUtc();
 
-        QCOMPARE(durationToDescriptiveString2(0), QString("0 second(s)") );
-        QCOMPARE(durationToDescriptiveString2(5), QString("0 second(s)") );
-        QCOMPARE(durationToDescriptiveString2(1000), QString("1 second(s)") );
-        QCOMPARE(durationToDescriptiveString2(1005), QString("1 second(s)") );
-        QCOMPARE(durationToDescriptiveString2(56123), QString("56 second(s)") );
-        QCOMPARE(durationToDescriptiveString2(90*sec), QString("1 minute(s) 30 second(s)") );
-        QCOMPARE(durationToDescriptiveString2(3*hour), QString("3 hour(s)") );
-        QCOMPARE(durationToDescriptiveString2(3*hour + 20*sec), QString("3 hour(s)") );
-        QCOMPARE(durationToDescriptiveString2(3*hour + 70*sec), QString("3 hour(s) 1 minute(s)") );
-        QCOMPARE(durationToDescriptiveString2(3*hour + 100*sec), QString("3 hour(s) 2 minute(s)") );
+        QCOMPARE(durationToDescriptiveString2(0), QStringLiteral("0 second(s)") );
+        QCOMPARE(durationToDescriptiveString2(5), QStringLiteral("0 second(s)") );
+        QCOMPARE(durationToDescriptiveString2(1000), QStringLiteral("1 second(s)") );
+        QCOMPARE(durationToDescriptiveString2(1005), QStringLiteral("1 second(s)") );
+        QCOMPARE(durationToDescriptiveString2(56123), QStringLiteral("56 second(s)") );
+        QCOMPARE(durationToDescriptiveString2(90*sec), QStringLiteral("1 minute(s) 30 second(s)") );
+        QCOMPARE(durationToDescriptiveString2(3*hour), QStringLiteral("3 hour(s)") );
+        QCOMPARE(durationToDescriptiveString2(3*hour + 20*sec), QStringLiteral("3 hour(s)") );
+        QCOMPARE(durationToDescriptiveString2(3*hour + 70*sec), QStringLiteral("3 hour(s) 1 minute(s)") );
+        QCOMPARE(durationToDescriptiveString2(3*hour + 100*sec), QStringLiteral("3 hour(s) 2 minute(s)") );
         QCOMPARE(durationToDescriptiveString2(current.msecsTo(current.addYears(4).addMonths(5).addDays(2).addSecs(23*60*60))),
-                 QString("4 year(s) 5 month(s)") );
+                 QStringLiteral("4 year(s) 5 month(s)") );
         QCOMPARE(durationToDescriptiveString2(current.msecsTo(current.addDays(2).addSecs(23*60*60))),
-                 QString("2 day(s) 23 hour(s)") );
-
-        QCOMPARE(durationToDescriptiveString1(0), QString("0 second(s)") );
-        QCOMPARE(durationToDescriptiveString1(5), QString("0 second(s)") );
-        QCOMPARE(durationToDescriptiveString1(1000), QString("1 second(s)") );
-        QCOMPARE(durationToDescriptiveString1(1005), QString("1 second(s)") );
-        QCOMPARE(durationToDescriptiveString1(56123), QString("56 second(s)") );
-        QCOMPARE(durationToDescriptiveString1(90*sec), QString("2 minute(s)") );
-        QCOMPARE(durationToDescriptiveString1(3*hour), QString("3 hour(s)") );
-        QCOMPARE(durationToDescriptiveString1(3*hour + 20*sec), QString("3 hour(s)") );
-        QCOMPARE(durationToDescriptiveString1(3*hour + 70*sec), QString("3 hour(s)") );
-        QCOMPARE(durationToDescriptiveString1(3*hour + 100*sec), QString("3 hour(s)") );
+                 QStringLiteral("2 day(s) 23 hour(s)") );
+
+        QCOMPARE(durationToDescriptiveString1(0), QStringLiteral("0 second(s)") );
+        QCOMPARE(durationToDescriptiveString1(5), QStringLiteral("0 second(s)") );
+        QCOMPARE(durationToDescriptiveString1(1000), QStringLiteral("1 second(s)") );
+        QCOMPARE(durationToDescriptiveString1(1005), QStringLiteral("1 second(s)") );
+        QCOMPARE(durationToDescriptiveString1(56123), QStringLiteral("56 second(s)") );
+        QCOMPARE(durationToDescriptiveString1(90*sec), QStringLiteral("2 minute(s)") );
+        QCOMPARE(durationToDescriptiveString1(3*hour), QStringLiteral("3 hour(s)") );
+        QCOMPARE(durationToDescriptiveString1(3*hour + 20*sec), QStringLiteral("3 hour(s)") );
+        QCOMPARE(durationToDescriptiveString1(3*hour + 70*sec), QStringLiteral("3 hour(s)") );
+        QCOMPARE(durationToDescriptiveString1(3*hour + 100*sec), QStringLiteral("3 hour(s)") );
         QCOMPARE(durationToDescriptiveString1(current.msecsTo(current.addYears(4).addMonths(5).addDays(2).addSecs(23*60*60))),
-                 QString("4 year(s)") );
+                 QStringLiteral("4 year(s)") );
         QCOMPARE(durationToDescriptiveString1(current.msecsTo(current.addDays(2).addSecs(23*60*60))),
-                 QString("3 day(s)") );
+                 QStringLiteral("3 day(s)") );
 
     }